package com.ssy.lingxi.order.entity;

import com.ssy.lingxi.order.handler.converter.JpaJsonToPaymentParameterConverter;
import com.ssy.lingxi.order.model.bo.PaymentParameterBO;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 会员支付参数设置
 * @author 万宁
 * @version 2.0.0
 * @date 2021-08-10
 */
@Entity
@Table(schema = "public", name = "ord_member_payment_parameter", indexes = {@Index(name = "ord_member_payment_parameter_member_idx", columnList = "memberId, roleId")})
public class MemberPaymentParameterDO implements Serializable {
    private static final long serialVersionUID = 9146505617937665456L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_member_payment_parameter_seq")
    @SequenceGenerator(sequenceName = "ord_member_payment_parameter_seq", name = "ord_member_payment_parameter_seq", allocationSize = 1)
    private Long id;

    /**
     * 会员Id
     */
    @Column
    private Long memberId;

    /**
     * 会员角色Id
     */
    @Column
    private Long roleId;

    /**
     * 支付方式
     */
    @Column
    private Integer payType;

    /**
     * 支付方式名称
     */
    @Column(columnDefinition = "varchar(100)")
    private String payTypeName;

    /**
     * 支付渠道，定义在 OrderPayChannelEnum 中
     */
    @Column
    private Integer payChannel;

    /**
     * 支付渠道名称
     */
    @Column(columnDefinition = "varchar(100)")
    private String payChannelName;

    /**
     * 支付参数Json对象
     */
    @Convert(converter = JpaJsonToPaymentParameterConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<PaymentParameterBO> parameters;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public String getPayTypeName() {
        return payTypeName;
    }

    public void setPayTypeName(String payTypeName) {
        this.payTypeName = payTypeName;
    }

    public Integer getPayChannel() {
        return payChannel;
    }

    public void setPayChannel(Integer payChannel) {
        this.payChannel = payChannel;
    }

    public String getPayChannelName() {
        return payChannelName;
    }

    public void setPayChannelName(String payChannelName) {
        this.payChannelName = payChannelName;
    }

    public List<PaymentParameterBO> getParameters() {
        return parameters;
    }

    public void setParameters(List<PaymentParameterBO> parameters) {
        this.parameters = parameters;
    }
}
